﻿using System;

using Microsoft.Xna.Framework;
using OakEngine.AI.Dynamic_Steering_Behavior;
using OakEngine.AI.Steering;

namespace OakEngine.AI.Flocking
{
    public class Oak_Separation : Oak_FlockSteeringBehavior
    {
        private Oak_DynamicFlee m_Flee;
        public Oak_DynamicFlee Flee { get { return m_Flee; } set { m_Flee = value; } }

        public Oak_Separation()
        {
            m_Flee = new Oak_DynamicFlee();
        }

        public override void UpdateSteeringMovement(Oak_Steering steer)
        {
            int count = this.Flock.SetArea(this.BehaviorAgent, this.FlockSize, this.MinFotProduct);

            if(count <=0)
                return;

            Vector2 center = this.Flock.GetAreaCenter();

            // Lets steer Away
            m_Flee.Speed = this.Speed;
            m_Flee.BehaviorAgent = this.BehaviorAgent;
            m_Flee.Target = center;
            m_Flee.UpdateSteeringMovement(steer);
        }
    }
}
